<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style type="text/css">
      .gridtable {
        font-family: verdana,arial,sans-serif;
        font-size:11px;
        color:#333333;
        border-width: 1px;
        border-color: #666666;
        border-collapse: collapse;
      }
      .gridtable th {
        border-width: 1px;
        padding: 8px;
        border-style: solid;
        border-color: #666666;
        background-color: #dedede;
      }
      .gridtable td {
        border-width: 1px;
        padding: 8px;
        border-style: solid;
        border-color: #666666;
        background-color: #ffffff;
      }
    </style>
  </head>
  <body>
    <table width="500px" id="tb" align="center" class="gridtable">
     <th>课程名称</th>
     <th>课程地址</th>
     <th>课程类型</th>
    </table>
  </body>
  <script>
    fetch('/getlist')
    .then(function(response) {
      return response.json();
    })
    .then(function(myJson) {
      var courseList = myJson;
      var tb = document.getElementById("tb");
      for(var i = 0; i < courseList.length; i++) {
        var tdNode = "<td>" +
                      courseList[i].courseName +
                    "</td>" +
                    "<td>" +
                      courseList[i].courseUrl +
                    "</td>" +
                    "<td>" +
                      courseList[i].courseType + 
                    "</td>";
        var trNode = document.createElement("tr");
        trNode.innerHTML = tdNode;
        tb.appendChild(trNode);
      }
    });
  </script>
</html>

